<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Variable Scope</title>
  </head>
  <body>
    <script>
      const a = 10;
      var b = 10;

      function showVars() {
        const a = 20;
        // 修改全局变量b的值
        b = 20;
        return "Local varibale 'a' = " + a + "\nGlobal variable'b' = " + b;
      }

      const message = showVars();
      alert(message + "\nGlobal variable'a' = " + a);
    </script>
  </body>
</html>
